package com.example.yangxu0703.thundermapclient.util;

import android.app.ProgressDialog;
import android.content.Context;

/**
 * Created by yangxu0703 on 18-3-19.
 */

public class ProgressDialogUtil {
    private  ProgressDialog progressDialog;
    private static ProgressDialogUtil progressDialogUtil;
    public static  ProgressDialogUtil getInstance(Context context){
        if (progressDialogUtil==null){
            progressDialogUtil=new ProgressDialogUtil(context);
        }
        return progressDialogUtil;
    }

    private ProgressDialogUtil(Context context){
        if (progressDialog==null){
            progressDialog =new ProgressDialog(context);
        }
            progressDialog.setCanceledOnTouchOutside(false);
    }

    public void showMSG(String msg){
        if (!progressDialog.isShowing()){
            progressDialog.setMessage(msg);
        }
        progressDialog.show();
    }

    public void dismissDia(){
        if (progressDialog.isShowing()){
            progressDialog.dismiss();
        }
    }
}
